#ifndef _EDITLAYER_H_
#define _EDITLAYER_H_

#include <SECore/Layer.h>
#include <SERender/Renderer/Renderer.h>
#include <memory>
#include <SEUi/Widget/Widget.h>
#include <SECore/Descriptor.h>
#include <SECore/OrderedMap.h>
#include <SEEdit/Descriptors/WidgetsDescriptor.h>

namespace SEngine
{
    class Actor;
    class EditLayer : public Layer
    {
    public:
        EditLayer(CoreApplication & app) 
            : Layer(app) {}
        virtual ~EditLayer() = default;
        virtual std::string Name() override { return "EditLayer"; };

        void Attach() override;
        void Detach() override;
        void BeginFrame() override {}
        void EndFrame() override {}
        void Update(int delta) override;
        void OnEvent(EventPtr) override;

        std::optional<std::reference_wrapper<Actor>> GetSelectActor();
        void DeleteActor(Actor & actor);
        Actor & CreateActor();
        Actor & CloneActor(Actor & actor);
        void FocusWidget(WidgetsDescriptor::WidgetTypes type);

    private:
        void ShowMainMenuBar();
        void LoadProjConfig();
        void SaveProjConfig();
        void AddWidget(std::unique_ptr<Widget> && widget);

    private:
        OrderedMap<std::string, std::unique_ptr<Widget>> m_widgets;
    };
} // namespace SEngine


#endif